package com.lipaluma.example.clients.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="t_account")
public class Account {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	private String libelle;
	
	@ManyToOne
	private Client client;
	
	@OneToOne
	private PaymentMean paymentMean;
	
	@OneToMany(mappedBy="account", cascade={CascadeType.MERGE, CascadeType.PERSIST}, fetch=FetchType.EAGER)
	private List<Invoice> invoices;
	
	@OneToMany(mappedBy="account", cascade={CascadeType.MERGE, CascadeType.PERSIST})
	private List<Order> orders;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getLibelle() {
		return libelle;
	}
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	public PaymentMean getPaymentMean() {
		return paymentMean;
	}
	public void setPaymentMean(PaymentMean paymentMean) {
		this.paymentMean = paymentMean;
	}
	public List<Invoice> getInvoices() {
		return invoices;
	}
	public void setInvoices(List<Invoice> invoices) {
		this.invoices = invoices;
	}
	public List<Order> getOrders() {
		return orders;
	}
	public void setOrders(List<Order> orders) {
		this.orders = orders;
	}
	public Client getClient() {
		return client;
	}
	public void setClient(Client client) {
		this.client = client;
	}
}
